//
//package cn.doourbest.learnspring.config;
//
//import cn.doourbest.learnspring.filter.MyFilter;
//import org.springframework.web.WebApplicationInitializer;
//import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
//import org.springframework.web.servlet.DispatcherServlet;
//
//import javax.servlet.*;
//import java.util.EnumSet;
//
//
//public class LearnSpringMain implements WebApplicationInitializer {
//
//    @Override
//    public void onStartup(ServletContext servletContext) throws ServletException {
//
//        AnnotationConfigWebApplicationContext aa =
//                new AnnotationConfigWebApplicationContext();
//        aa.register(LearnSpringConfig.class);
//        aa.setServletContext(servletContext);
//
//        DispatcherServlet dispatcherServlet = new DispatcherServlet(aa);
//        dispatcherServlet.setEnableLoggingRequestDetails(true);
//        ServletRegistration.Dynamic ds = servletContext.addServlet("dispatcherServlet",dispatcherServlet);
//
//
//        FilterRegistration.Dynamic myFilter = servletContext.addFilter("myFilter", "cn.doourbest.learnspring.filter.MyFilter");
//
//        EnumSet<DispatcherType> enumSet = EnumSet.noneOf(DispatcherType.class);
//        enumSet.add(DispatcherType.REQUEST);
//        myFilter.addMappingForServletNames(enumSet,true,"dispatcherServlet");
//
//        ds.addMapping("/*");
//        ds.setLoadOnStartup(1);
//    }
//}
//
